export default data => {
  const methodRef = ref(null)

  const register = methods => {
    methodRef.value = methods
    methodRef.value.initData(data)
  }

  const validate = () => {
    return methodRef.value.validate()
  }

  const getForm = () => {
    return methodRef.value.getForm()
  }

  const setForm = data => {
    methodRef.value.setForm(data)
  }

  return [register, { validate, getForm, setForm }]
}
